]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
loginManager: Handle unset XDG_SESSION_ID more gracefully
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 5 Nov 2015 13:49:23 +0000 (14:49 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 22 Sep 2017 16:46:01 +0000 (18:46 +0200)
While certain functionality won't be available when running outside a
(logind) user session, that's still better than crashing ...

https://bugzilla.gnome.org/show_bug.cgi?id=788046

js/misc/loginManager.js

index ed390f720cc8ca3c713567732608530633917199..d2c7290532fecd05568d578567ff62a1eac21cd3 100644 (file)
@@ -119,7 +119,13 @@ var LoginManagerSystemd = new Lang.Class({
             return;
         }
 
-        this._proxy.GetSessionRemote(GLib.getenv('XDG_SESSION_ID'), Lang.bind(this,
+        let sessionId = GLib.getenv('XDG_SESSION_ID');
+        if (!sessionId) {
+            log('Unset XDG_SESSION_ID, getCurrentSessionProxy() called outside a user session.');
+            return;
+        }
+
+        this._proxy.GetSessionRemote(sessionId, Lang.bind(this,
             function(result, error) {
                 if (error) {
                     logError(error, 'Could not get a proxy for the current session');